package com.smarthospital.web.controller;

import com.github.pagehelper.PageInfo;
import com.smarthospital.common.Result.ResultDTO;
import com.smarthospital.entity.pojo.Hospital;
import com.smarthospital.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * create by sym  2020/8/16 16:00.
 */
@RestController
@Slf4j
@RequestMapping("/hospital")
@Api(tags = "医院接口")
public class HospitalController {

    @Autowired
    private UserService userService;

    @GetMapping("/list")
    @ApiOperation(value = "医院列表",
            notes =" 医院列表，分页查询\n " +
                    "       pageSize -> 页码大小\n" +
                    "       pageNum -> 当前页数" )
    public ResultDTO list(@RequestHeader("SH_TOKEN")String SH_TOKEN,
                           @RequestParam("pageSize")Integer pageSize, @RequestParam("pageNum")Integer pageNum){
        log.info("list pageSize {} pageNum {}",pageSize,pageNum );
        PageInfo<Hospital> pageInfo = userService.querHospitals(pageSize,pageNum);
        return ResultDTO.sucess(pageInfo);
    }



}
